package com.sec.android.app.myfiles.shadow.android;

import android.os.Environment;

import com.sec.android.app.myfiles.mockclass.FileMock;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

import java.io.File;

/**
 * Created by jaebae on 2016-06-30.
 */

@Implements(Environment.class)
public class ShadowEnvironment {

    private static final String ROOT_PATH = "/mnt/sdcard";
    private static final String DOWNLOAD_PATH = "/mnt/sdcard/Downloads";

    @Implementation
    public static File getExternalStorageDirectory() {
        File file = FileMock.createMock(ROOT_PATH);
        return file;
    }

    @Implementation
    public static File getExternalStoragePublicDirectory(String type) {
        File file = null;
        if(type.equals(Environment.DIRECTORY_DOWNLOADS)){
            file = FileMock.createMock(DOWNLOAD_PATH);
        }
        return file;
    }
}
